home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / WIN_PRO / VIEWS.ZIP;1 / CVDZIP.EXE / CVORDER.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-21  |  2.2 KB  |  109 lines

  1. /*
  2.     cvorder.cpp
  3.  
  4.     How to order dialog (adapted from FeatureView)
  5.     
  6.     C++/Views 2.0 Demo
  7.     Copyright (c) 1992, by Liant Software Corp.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12. */
  13.  
  14. #include "cvorder.h"
  15. #include "cvdemovw.h"
  16. #include "editbox.h"
  17. #include "listbox.h"
  18. #include "pushbttn.h"
  19. #include "messengr.h"
  20. #include "font.h"
  21. #include "tagstrm.h"
  22.  
  23. defineClass(OrderDialog, VDialog)
  24.  
  25. OrderDialog::OrderDialog()
  26. {
  27.     ;
  28. }
  29.  
  30. OrderDialog::OrderDialog(VWindow *parent)
  31.     :    VDialog(5, 30, 250, 180, parent, StyleTitle | StyleCloseBox)
  32. {
  33.     setTitle("How to Order C++/Views");
  34.  
  35.     listFont = new VFont("Arial", 10);
  36.     listFont->bold(TRUE);
  37.     msgFont = new VFont("Arial", 10);
  38.  
  39.     /* create a list box */
  40.     listBox = new VListBox(VFrame(0.05F, 0.05F, 0.9F, 0.4F), this, StyleBorder);
  41.     listBox->uponClick(this, methodOf(OrderDialog, singleClick),
  42.                              methodOf(OrderDialog, doubleClick));
  43.  
  44.     listBox->setFont(listFont);
  45.  
  46.     /* read in list of features from the message file */
  47.     VTagStream    tagStrm;
  48.     VString        cmd;
  49.     VStream        flist(cvTextFile->getMessage("Order:List"));
  50.  
  51.     tagStrm.beginScan(&flist, NIL);
  52.     tagStrm.tags('(', ')');
  53.  
  54.     while(tagStrm.getTag(cmd)) {
  55.         listBox->appendString(cmd.gets());
  56.     }
  57.  
  58.     /* create an edit box */
  59.     msgBox = new VEditBox(VFrame(0.05F, 0.5F, 0.9F, 0.35F), this,
  60.                     StyleBorder | StyleVertical | StyleWordWrap | StyleReadOnly);
  61.  
  62.     msgBox->setFont(msgFont);
  63.  
  64.     msgBox->putText(cvTextFile->getMessage("Order:Intro").gets());
  65.  
  66.     /* create OK button */
  67.     VPushButton *okButton;
  68.     okButton = new VPushButton(VFrame(0.5F, 0.9F, 50, 30, CenterDim), this, StyleDefault, "Ok");
  69.     okButton->uponClick(this, methodOf(VDialog, ok));
  70. }
  71.  
  72. OrderDialog::~OrderDialog()
  73. {
  74.     delete listFont;
  75.     delete msgFont;
  76. }
  77.  
  78. boolean OrderDialog::free()
  79. {
  80.     delete this;
  81.     return(TRUE);
  82. }
  83.  
  84. boolean OrderDialog::singleClick(int index)
  85. /*
  86.     Mouse clicked on the list box
  87. */
  88. {
  89.     VString    idx("Order:");
  90.     VString *temp;
  91.  
  92.     temp = listBox->selectedString();
  93.     idx.concat(temp);
  94.     delete temp;
  95.  
  96.     msgBox->putText(cvTextFile->getMessage(idx.gets()).gets());
  97.     return(TRUE);
  98. }
  99.  
  100. boolean OrderDialog::doubleClick(int index)
  101. /*
  102.     Mouse double-clicked on the list box
  103. */
  104. {
  105.     return(TRUE);
  106. }
  107.  
  108.  
  109.